﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="case_edit.aspx.cs" Inherits="ihongma.Web.admin.case_edit" ValidateRequest="false" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>编辑图文信息</title>
<link href="../../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="../images/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../scripts/jquery/jquery-1.5.2.min.js"></script>
<script type="text/javascript" src="../../scripts/jquery/jquery.form.js"></script>
<script type="text/javascript" src="../../scripts/jquery/jquery.validate.min.js"></script> 
<script type="text/javascript" src="../../scripts/jquery/messages_cn.js"></script>
<script type="text/javascript" src="../../scripts/ui/js/ligerBuild.min.js"></script>
<script type='text/javascript' src="../../scripts/swfupload/swfupload.js"></script>
<script type='text/javascript' src="../../scripts/swfupload/swfupload.queue.js"></script>
   
<script type="text/javascript" src="../js/function.js"></script>
<script type="text/javascript" charset="utf-8" src="../../editor/kindeditor-min.js"></script>
<script type="text/javascript" charset="utf-8" src="../../editor/lang/zh_CN.js"></script>
     <script src="../js/coldfusion.json.js" type="text/javascript"></script>
    <script src="../../scripts/phototagger.jquery.js" type="text/javascript"></script>
   
    <script type="text/javascript" src="../../scripts/swfupload/swfupload.handlers1.js"></script>
<script type="text/javascript">
    var agegaglist ='<%=showtag %>';

    if (agegaglist != "") {
       // alert( eval('('+agegaglist+')')[0]);
           $(function () {
        $("div.photo-container").photoTagger({
            loadURL: agegaglist,
            saveURL: "./save_Tag.cfm",
            deleteURL: "./delete_tag.cfm",
            cleanAJAXResponse: cleanColdFusionJSONResponse
        });
        $("div.photo-container").photoTagger("enableTagCreation");
        $("div.photo-container").photoTagger("enableTagDeletion");
    });
    }
    //加载编辑器
    $(function () {
      
        var editor = KindEditor.create('textarea[name="txtContent"]', {
            resizeType: 1,
            uploadJson: '../../tools/upload_ajax.ashx?action=EditorFile&IsWater=1',
            fileManagerJson: '../../tools/upload_ajax.ashx?action=ManagerFile',
            allowFileManager: true
        });
        
        var editor2 = KindEditor.create('textarea[name="dianping"]', {
            resizeType: 1,
            uploadJson: '../../tools/upload_ajax.ashx?action=EditorFile&IsWater=1',
            fileManagerJson: '../../tools/upload_ajax.ashx?action=ManagerFile',
            allowFileManager: true
        });

    });
    //表单验证
    $(function () {
        $("#form1").validate({
            invalidHandler: function (e, validator) {
                parent.jsprint("有 " + validator.numberOfInvalids() + " 项填写有误，请检查！", "", "Warning");
            },
            errorPlacement: function (lable, element) {
                //可见元素显示错误提示
                if (element.parents(".tab_con").css('display') != 'none') {
                    element.ligerTip({ content: lable.html(), appendIdTo: lable });
                }
            },
            success: function (lable) {
                lable.ligerHideTip();
            }
        });
    });
    //初始化上传控件
    $(function () {
        InitSWFUpload("../../tools/upload_ajax.ashx?type=case", "Filedata", "2 MB", "../../scripts/swfupload/swfupload.swf", 1, 1);
    });
     $(function () {
     ajaxlist();
     });

     function ajaxlist() {
         systag = $("#systemtag");
         systag.html("");
    ($).ajax({
        url: "/tools/tags.ashx?action=list",
        type: "post",
        dataType: "json",
        success: function (data) {

            for (var i = 0; i < data.length; i++) {
                var temp = $('<a href="javascript:void(0)"  rel="' + data[i].id + '">' + data[i].name + '</a>').click(function () {
                    addtags(this);
                });
                systag.append(temp);
            }
        }
    }); 
     }
</script>
<script type="text/javascript">
    function addtags(obj) {
        var data = $("#tags");
       
        
        var id = $(obj).attr("rel");
        if ($("#t" + id).length>0) {
            alert('已添加此标签');
            return;
        }
        
        $.get("/tools/tags.ashx?action=update&age=h&id=" + id, function (result) {
            
            //$("div").html(result);
        });
        //alert(2);
        var tagdiv=$('<div id="t'+id+'"></div>');
        $('<li"><a rel="tag" href="javascript:void(0)" >' + $(obj).html() + '<input id="Hidden1" type="hidden" name="tags" value="' + id + '" /></a></li>').appendTo(tagdiv);
        $("<em  style='cursor:pointer'>[X]</em>").click(
		function(){
		    $("#t"+id).remove();
		}).appendTo(tagdiv);

//		tagdiv.append(temp);
//		tagdiv.append(del);
//		alert(del.html());
		//alert(tagdiv.html());
	
	data.append(tagdiv);
}
function addtag() {

    $.post("/tools/tags.ashx",{ action: "add", name:$("#Text").val()}, function (result) {
        // alert(result);
        if (result == "True") {
            ajaxlist();
        }
        // $("div").html(result);
    });

}
function color(obj) {
    var data = $("#colors");
  
    var id = $(obj).attr("rel");
    //alert(1);
    if ($("#"+id).length > 0) {
        alert('已添加此标签');
        return;
    }
    //alert(2);
    var divnew = $('<div id="' + id + '"></div>')
    var temp = $(' <span   class="color ' + id + '"  ><input id="Hidden1" type="hidden" name="color" value="' + id + '" /></span>').appendTo(divnew);
    var del = $("<em style='cursor:pointer' >[X]</em>").click(
		function () {
		    $("#" + id).remove();
           
		}).appendTo(divnew);
    
    data.append(divnew);
    //alert(3);

}
</script>
</head>
<body  class="mainbody" >

<form id="form1" runat="server">
<div class="navigation"><a href="javascript:history.go(-1);" class="back">后退</a>首页 &gt; 图文管理 &gt; 编辑信息</div>
<div id="contentTab">
    <ul class="tab_nav">
        <li class="selected"><a onclick="tabs('#contentTab',0);" href="javascript:;">基本信息</a></li>
        <li><a onclick="tabs('#contentTab',1);" href="javascript:;">标签</a></li>
        <li><a onclick="tabs('#contentTab',2);" href="javascript:;">项目说明</a></li>
    </ul>

    <div class="tab_con" style="display:block;">
        <table class="form_table">
            <col width="150px"><col>
            <tbody>
           
            <tr>
                <th>标题名称：</th>
                <input id="showid" type="hidden" runat="server" />
                <td><asp:TextBox ID="txtTitle" runat="server" CssClass="txtInput normal required" maxlength="100" /></td>
            </tr>
            <tr>
                <th>推荐类型：</th>
                <td>
                    <asp:CheckBoxList ID="cblItem" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                                               <asp:ListItem Value="1">置顶</asp:ListItem>
                                                <asp:ListItem Value="1">锁定</asp:ListItem>
                    </asp:CheckBoxList>
                </td>
            </tr>
            <tr>
                <th>网站URL：</th>
                <td><asp:TextBox ID="txtUrl" runat="server" CssClass="txtInput"  Width="300px"  maxlength="300"></asp:TextBox></td>
            </tr>
          
            <tr>
                <th>排序：</th>
                <td><asp:TextBox ID="txtclick" runat="server" CssClass="txtInput small required digits" maxlength="10">99</asp:TextBox></td>
            </tr>
           
            
            <tr>
                <th valign="top" style="padding-top:10px;">图文相册：</th>
                <td>
                    <input type="text" class="txtInput normal left" />
                    <div class="upload_btn"><span id="upload"></span></div><label>可以上传多张图片。</label>
                    <div class="clear"></div>
                    <!--封面隐藏值.开始-->
                    <!--
                    <input type="hidden" name="focus_photo" id="focus_photo" value=""/>
                    -->
                    <asp:HiddenField ID="focus_photo" runat="server" />
                    <!--封面隐藏值.结束-->
                    <!--上传提示.开始-->
                    <div id="show"></div>
                    <!--上传提示.结束-->
                    <!--图片列表.开始-->
                    <div id="show_list">
                        <ul>
                          <asp:Literal ID="LitAlbumList" runat="server"></asp:Literal>
                        </ul>
                    </div>
                    <!--图片列表.结束-->
                </td>
            </tr>
           
            <!--
            <tr>
                <th>扩展属性：</th>
                <td>
                    <table border="0" cellspacing="0" cellpadding="0" class="border_table">
                        <tbody>
                        <col width="80px"><col>
                        <tr>
                            <th>属性一</th>
                            <td><input name="nav_url" type="text" value="" class="txtInput middle" /></td>
                        </tr>
                        <tr>
                            <th>属性二</th>
                            <td><input name="nav_url" type="text" value="" class="txtInput middle" /></td>
                        </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
            -->
            <!--扩展属性.开始-->
            <asp:Literal ID="LitAttributeList" runat="server"></asp:Literal>
            <!--扩展属性.结束-->

            </tbody>
        </table>
    </div>

    <div class="tab_con">
        <table class="form_table">
            <col width="150px"><col>
            <tbody>
            <tr>
                <th>标签：</th>
                <td ><div id="tags" class="tags" runat="server">
                    <asp:Literal ID="tagslist" runat="server"></asp:Literal>  </div> 
                    
                </td>
            </tr>
            <tr>
                <th>系统标签：</th>
                <td>
                   <div id="systemtag" class="tags" runat="server"></div>
                   <input id="Text" type="text"  /><input id="Button1" type="button" onclick="addtag()" value="添加" />
                </td>
            </tr>
            <tr>
                
                <th>颜色：</th>
                <td id="colors" class="menucolor">
                    <asp:Literal ID="colorlist" runat="server" />
                </td>
            </tr>
            <tr>
                <th>常用颜色：</th>
                <td><div class="menucolor">
          <span  class="color red"  rel="red" onclick="color(this)">红色</span>
          <span  class="color yellow" rel="yellow" onclick="color(this)">黄色</span>
          <span  class="color green" rel="green" onclick="color(this)">绿色</span>
          <span  class="color blue" rel="blue" onclick="color(this)">蓝色</span>
          <span  class="color orange" rel="orange" onclick="color(this)">橙色</span>
          <span  class="color pink" rel="pink" onclick="color(this)">粉红</span>
          <span  class="color gray" rel="gray" onclick="color(this)">银色</span>
          <span  class="color white" rel="white" onclick="color(this)">白色</span>
          <span  class="color brown" rel="brown" onclick="color(this)">棕色</span>
          <span  class="color black" rel="black" onclick="color(this)">黑色</span>
		</div></td>
            </tr>
           
            </tbody>
        </table>
    </div>

    <div class="tab_con">
        <table class="form_table">
            <col width="150px"><col>
            <tbody>
            <tr>
                <th valign="top">项目说明：</th>
                <td>
                    <textarea id="dianping" cols="100" rows="8" style="width:99%;height:350px;visibility:hidden;" runat="server"></textarea>
                </td>
            </tr>
              <tr>
                <th valign="top">详细描述：</th>
                <td>
                    <textarea id="txtContent" cols="100" rows="8" style="width:99%;height:350px;visibility:hidden;" runat="server"></textarea>
                </td>
            </tr>
            </tbody>
        </table>
    </div>

    <div class="foot_btn_box">
    <asp:Button ID="btnSubmit" runat="server" Text="提交保存" CssClass="btnSubmit" onclick="btnSubmit_Click" />
    &nbsp;<input name="重置" type="reset" class="btnSubmit" value="重 置" />
    </div>
</div>
</form>
</body>
</html>
